#pragma once

#include "iostream"
#include "vector"
#include "algorithm"

using namespace std;

/*HJJ QQ479287006
 *
 * */

bool findDiff(string &s1, string &s2) {
    //寻找s1 和s2 相同字母数

    int low = 0;
    int count = 0;
    while (low < s1.size()) {

        if (s1[low] == s2[low])
            ++count;

        ++low;
    }


    return s1.size() - count <= 2;

}

vector<string> twoEditWords(vector<string> &queries, vector<string> &dictionary) {

    vector<string> res;

    for (int i = 0; i < queries.size(); ++i) {


        for (int j = 0; j < dictionary.size(); ++j) {

            if (findDiff(queries[i], dictionary[j])) {
                res.push_back(queries[i]);
                break;
            }

        }

    }


    return res;

}